//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.customer;

import java.awt.*;
import javax.swing.*;

public class CustomerPanelGUI extends JPanel {

    public CustomerPanelGUI() {
        contentPanel = null;
        statusLabel = null;
        lastnameLabel = null;
        firstnameLabel = null;
        addrLn1Label = null;
        addrLn2Label = null;
        zipLabel = null;
        cityLabel = null;
        telTxtLabel = null;
        telLabel = null;
        celTxtLabel = null;
        celLabel = null;
        faxTxtLabel = null;
        faxLabel = null;
        emailTxtLabel = null;
        emailLabel = null;
        notesLabel = null;
        jTabbedPane = null;
        mainPanel = null;
        customerId = null;
        initialize();
    }

    private void initialize() {
        setLayout(new BorderLayout());
        setSize(300, 182);
        add(getJTabbedPane(), "Center");
    }

    private JPanel getContentPanel() {
        if (contentPanel == null) {
            statusLabel = new JLabel();
            lastnameLabel = new JLabel();
            firstnameLabel = new JLabel();
            addrLn1Label = new JLabel();
            addrLn2Label = new JLabel();
            zipLabel = new JLabel();
            cityLabel = new JLabel();
            telTxtLabel = new JLabel();
            telLabel = new JLabel();
            celTxtLabel = new JLabel();
            celLabel = new JLabel();
            faxTxtLabel = new JLabel();
            faxLabel = new JLabel();
            emailTxtLabel = new JLabel();
            emailLabel = new JLabel();
            notesLabel = new JLabel();
            contentPanel = new JPanel();
            contentPanel.setLayout(null);
            contentPanel.setPreferredSize(new Dimension(280, 146));
            contentPanel.setBackground(Color.white);
            statusLabel.setText("status");
            statusLabel.setSize(40, 16);
            statusLabel.setLocation(5, 2);
            statusLabel.setPreferredSize(new Dimension(40, 16));
            lastnameLabel.setText("lastname");
            lastnameLabel.setSize(100, 16);
            lastnameLabel.setLocation(48, 2);
            lastnameLabel.setPreferredSize(new Dimension(53, 16));
            firstnameLabel.setText("firstname");
            firstnameLabel.setSize(121, 16);
            firstnameLabel.setLocation(149, 2);
            addrLn1Label.setText("addrLn1");
            addrLn1Label.setLocation(5, 20);
            addrLn1Label.setSize(130, 16);
            addrLn2Label.setText("addrLn2");
            addrLn2Label.setLocation(140, 20);
            addrLn2Label.setSize(130, 16);
            zipLabel.setText("zip");
            zipLabel.setSize(70, 16);
            zipLabel.setLocation(5, 38);
            cityLabel.setText("city");
            cityLabel.setSize(193, 16);
            cityLabel.setLocation(77, 38);
            telTxtLabel.setText("T\351l");
            telTxtLabel.setSize(70, 16);
            telTxtLabel.setLocation(5, 56);
            telLabel.setText("tel");
            telLabel.setLocation(77, 56);
            telLabel.setSize(193, 16);
            celTxtLabel.setText("Portable");
            celTxtLabel.setSize(70, 16);
            celTxtLabel.setLocation(5, 74);
            celLabel.setText("cel");
            celLabel.setLocation(77, 74);
            celLabel.setSize(193, 16);
            faxTxtLabel.setText("Fax");
            faxTxtLabel.setLocation(5, 92);
            faxTxtLabel.setSize(70, 16);
            faxLabel.setText("fax");
            faxLabel.setSize(193, 16);
            faxLabel.setLocation(77, 92);
            emailTxtLabel.setText("Email");
            emailTxtLabel.setLocation(5, 110);
            emailTxtLabel.setSize(70, 16);
            emailLabel.setText("email");
            emailLabel.setSize(193, 16);
            emailLabel.setLocation(77, 110);
            notesLabel.setText("notes");
            notesLabel.setSize(265, 16);
            notesLabel.setLocation(5, 128);
            contentPanel.add(statusLabel, null);
            contentPanel.add(lastnameLabel, null);
            contentPanel.add(firstnameLabel, null);
            contentPanel.add(addrLn1Label, null);
            contentPanel.add(addrLn2Label, null);
            contentPanel.add(zipLabel, null);
            contentPanel.add(cityLabel, null);
            contentPanel.add(telTxtLabel, null);
            contentPanel.add(telLabel, null);
            contentPanel.add(celTxtLabel, null);
            contentPanel.add(celLabel, null);
            contentPanel.add(faxTxtLabel, null);
            contentPanel.add(faxLabel, null);
            contentPanel.add(emailTxtLabel, null);
            contentPanel.add(emailLabel, null);
            contentPanel.add(notesLabel, null);
        }
        return contentPanel;
    }

    private JTabbedPane getJTabbedPane() {
        if (jTabbedPane == null) {
            jTabbedPane = new JTabbedPane();
            jTabbedPane.setPreferredSize(new Dimension(300, 180));
            jTabbedPane.addTab("Client", new ImageIcon(getClass().getResource("/org/jpgolay/wi/images/customerList16x16.png")), getMainPanel(), null);
        }
        return jTabbedPane;
    }

    private JPanel getMainPanel() {
        if (mainPanel == null) {
            FlowLayout flowLayout2 = new FlowLayout();
            mainPanel = new JPanel();
            mainPanel.setLayout(flowLayout2);
            mainPanel.setPreferredSize(new Dimension(290, 150));
            mainPanel.setBorder(BorderFactory.createLineBorder(Color.orange, 2));
            mainPanel.setBackground(Color.white);
            mainPanel.setToolTipText("Extrait de la fiche client");
            flowLayout2.setHgap(3);
            flowLayout2.setVgap(3);
            mainPanel.add(getContentPanel(), null);
        }
        return mainPanel;
    }

    public String getAddrLn1Label() {
        return addrLn1Label.getText();
    }

    public void setAddrLn1Label(String txt) {
        addrLn1Label.setText(txt);
    }

    public String getAddrLn2Label() {
        return addrLn2Label.getText();
    }

    public void setAddrLn2Label(String txt) {
        addrLn2Label.setText(txt);
    }

    public String getCelLabel() {
        return celLabel.getText();
    }

    public void setCelLabel(String txt) {
        celLabel.setText(txt);
    }

    public String getCityLabel() {
        return cityLabel.getText();
    }

    public void setCityLabel(String txt) {
        cityLabel.setText(txt);
    }

    public String getEmailLabel() {
        return emailLabel.getText();
    }

    public void setEmailLabel(String txt) {
        emailLabel.setText(txt);
    }

    public String getFaxLabel() {
        return faxLabel.getText();
    }

    public void setFaxLabel(String txt) {
        faxLabel.setText(txt);
    }

    public String getFirstnameLabel() {
        return firstnameLabel.getText();
    }

    public void setFirstnameLabel(String txt) {
        firstnameLabel.setText(txt);
    }

    public String getLastnameLabel() {
        return lastnameLabel.getText();
    }

    public void setLastnameLabel(String txt) {
        lastnameLabel.setText(txt);
    }

    public String getNotesLabel() {
        return notesLabel.getText();
    }

    public void setNotesLabel(String txt) {
        notesLabel.setText(txt);
    }

    public String getStatusLabel() {
        return statusLabel.getText();
    }

    public void setStatusLabel(String txt) {
        statusLabel.setText(txt);
    }

    public String getTelLabel() {
        return telLabel.getText();
    }

    public void setTelLabel(String txt) {
        telLabel.setText(txt);
    }

    public String getZipLabel() {
        return zipLabel.getText();
    }

    public void setZipLabel(String txt) {
        zipLabel.setText(txt);
    }

    public void initFields() {
        setAddrLn1Label("");
        setAddrLn2Label("");
        setCelLabel("");
        setCityLabel("");
        setEmailLabel("");
        setFaxLabel("");
        setFirstnameLabel("");
        setLastnameLabel("");
        setNotesLabel("");
        setStatusLabel("");
        setTelLabel("");
        setZipLabel("");
        customerId = null;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }
    private JPanel contentPanel;
    private JLabel statusLabel;
    private JLabel lastnameLabel;
    private JLabel firstnameLabel;
    private JLabel addrLn1Label;
    private JLabel addrLn2Label;
    private JLabel zipLabel;
    private JLabel cityLabel;
    private JLabel telTxtLabel;
    private JLabel telLabel;
    private JLabel celTxtLabel;
    private JLabel celLabel;
    private JLabel faxTxtLabel;
    private JLabel faxLabel;
    private JLabel emailTxtLabel;
    private JLabel emailLabel;
    private JLabel notesLabel;
    private JTabbedPane jTabbedPane;
    private JPanel mainPanel;
    private Integer customerId;
}
